package com.weng.bigdata.core.database.enums;

/**
 *  查询参数类型枚举
 * @author wengzhonghui
 * @date 17:02 2019/9/25
 */
public enum SqlQueryParamTypesEnum {

    INT(1),
    STRING(2),
    DATE(3),
    DOUBLE(4),
    DECIMAL(5),
    TIMESTAMP(6);


    private Integer type;

    SqlQueryParamTypesEnum(final Integer type) {
        this.type = type;
    }

    public String getName() {
        return name();
    }

    public Integer getValue() {
        return type;
    }

    public static SqlQueryParamTypesEnum valueOf(int type) {
        for( SqlQueryParamTypesEnum sqlType : SqlQueryParamTypesEnum.class.getEnumConstants()) {
            if(type == sqlType.type){
								return sqlType;
						}
        }
        throw new IllegalArgumentException("Type:" + type + " is not a valid "
                + "Types.java value.");
    }
}
